package nginx

// DisablePagePath 禁用页面路径
const DisablePagePath = "/opt/ace/server/nginx/stop"

// SitesPath 网站目录
const SitesPath = "/opt/ace/sites"

// 配置文件序号范围
const (
	RedirectStartNum = 100 // 重定向配置起始序号 (100-199)
	RedirectEndNum   = 199
	ProxyStartNum    = 200 // 代理配置起始序号 (200-299)
	ProxyEndNum      = 299
	UpstreamStartNum = 100 // 上游服务器配置起始序号
)

const DefaultConf = `include /opt/ace/sites/default/config/shared/*.conf;
server {
    listen 80;
    server_name localhost;
    root /opt/ace/sites/default/public;
    index index.php index.html;
    # custom configs
    include /opt/ace/sites/default/config/site/*.conf;
}
`

// order 定义 Nginx 指令的排序优先级
var order = map[string]int{
	"listen":      0,
	"server_name": 1,

	"root":      10,
	"index":     11,
	"try_files": 12,
	"charset":   13,
	"autoindex": 14,

	"client_max_body_size":    100,
	"client_body_buffer_size": 101,
	"limit_except":            102,
	"limit_req_zone":          103,
	"limit_req":               104,
	"limit_conn_zone":         105,
	"limit_conn":              106,
	"allow":                   107,
	"deny":                    108,
	"auth_basic":              109,
	"auth_basic_user_file":    110,

	"ssl":                       200,
	"ssl_certificate":           201,
	"ssl_certificate_key":       202,
	"ssl_session_timeout":       203,
	"ssl_session_cache":         204,
	"ssl_session_tickets":       205,
	"ssl_protocols":             206,
	"ssl_ciphers":               207,
	"ssl_prefer_server_ciphers": 208,
	"ssl_early_data":            209,
	"ssl_dhparam":               210,
	"ssl_stapling":              211,
	"ssl_stapling_verify":       212,
	"ssl_trusted_certificate":   213,

	"resolver":         300,
	"resolver_timeout": 301,

	"proxy_pass":                     400,
	"proxy_redirect":                 401,
	"proxy_set_header":               402,
	"proxy_hide_header":              403,
	"proxy_pass_header":              404,
	"proxy_http_version":             405,
	"proxy_method":                   406,
	"proxy_headers_hash_max_size":    407,
	"proxy_headers_hash_bucket_size": 408,
	"proxy_buffering":                409,
	"proxy_buffer_size":              410,
	"proxy_buffers":                  411,
	"proxy_busy_buffers_size":        412,
	"proxy_max_temp_file_size":       413,
	"proxy_read_timeout":             414,
	"proxy_send_timeout":             415,
	"proxy_connect_timeout":          416,
	"proxy_next_upstream":            417,
	"proxy_next_upstream_tries":      418,
	"proxy_next_upstream_timeout":    419,
	"proxy_no_cache":                 420,
	"proxy_cache":                    421,
	"proxy_cache_key":                422,
	"proxy_cache_valid":              423,
	"proxy_cache_bypass":             424,
	"proxy_cache_use_stale":          425,
	"proxy_cache_lock":               426,
	"proxy_cache_lock_timeout":       427,
	"proxy_cache_background_update":  428,
	"proxy_cache_min_uses":           429,
	"proxy_ignore_client_abort":      430,
	"proxy_intercept_errors":         431,
	"proxy_ssl_server_name":          432,
	"proxy_ssl_name":                 433,
	"proxy_ssl_protocols":            434,
	"proxy_ssl_ciphers":              435,
	"proxy_ssl_verify":               436,
	"proxy_ssl_verify_depth":         437,
	"proxy_ssl_trusted_certificate":  438,

	"fastcgi_pass":                 500,
	"fastcgi_index":                501,
	"fastcgi_param":                502,
	"fastcgi_split_path_info":      503,
	"fastcgi_buffers":              504,
	"fastcgi_buffer_size":          505,
	"fastcgi_busy_buffers_size":    506,
	"fastcgi_temp_file_write_size": 507,
	"fastcgi_read_timeout":         508,
	"fastcgi_send_timeout":         509,
	"fastcgi_connect_timeout":      510,
	"fastcgi_intercept_errors":     511,

	"uwsgi_pass":            600,
	"uwsgi_param":           601,
	"uwsgi_read_timeout":    602,
	"uwsgi_send_timeout":    603,
	"uwsgi_connect_timeout": 604,

	"grpc_pass":         700,
	"grpc_read_timeout": 701,
	"grpc_send_timeout": 702,

	"proxy_cache_path":   800,
	"fastcgi_cache_path": 801,
	"uwsgi_cache_path":   802,
	"proxy_temp_path":    803,
	"fastcgi_temp_path":  804,
	"uwsgi_temp_path":    805,

	"gzip":            900,
	"gzip_comp_level": 901,
	"gzip_min_length": 902,
	"gzip_types":      903,
	"gzip_buffers":    904,
	"gzip_proxied":    905,
	"gzip_disable":    906,
	"gzip_vary":       907,

	"brotli":            910,
	"brotli_comp_level": 911,
	"brotli_min_length": 912,
	"brotli_types":      913,

	"zstd":            920,
	"zstd_comp_level": 921,
	"zstd_min_length": 922,
	"zstd_types":      923,
	"zstd_static":     924,

	"add_header": 1000,
	"expires":    1001,

	"rewrite": 1100,
	"return":  1101,

	"error_page": 1200,

	"if":       1300,
	"location": 1301,

	"include": 1400,

	"access_log": 1500,
	"error_log":  1501,
}
